/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package concesionaria;
import javax.swing.*;
import java.sql.*;
/**
 *
 * @author Guillermo
 */
public class Concesionaria {
   public static Connection cn;
   
   
   
   
   
   public static void cargarDriver()
    {
        try
        {
             Class.forName("com.mysql.jdbc.Driver");
        }
        catch(ClassNotFoundException e)
        {
            JOptionPane.showMessageDialog(null,"Error no se puede cargar el driver: "+e.getMessage());
        }
    }
   
   
   public static void conexionBaseDatos()
    {
        // Establecer la conexion con la base de datos
        try{
            String url="jdbc:mysql://localhost:3306/concesionaria";
            String user="root";
            String password="";
            cn=DriverManager.getConnection(url,user,password);

        }catch(SQLException e)
        {
            JOptionPane.showMessageDialog(null,"Error no se puede establecer la conexion: "+e.getMessage());
        }
      //  JOptionPane.showMessageDialog(null,"Conexion Exitosa");
    }

   
   
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       
       cargarDriver();
       conexionBaseDatos();
       Statement stmt = null;
            ResultSet rs = null;
            //SQL query command
    /*        try{
            String SQL = "SELECT * FROM auto";
            stmt = cn.createStatement();
            rs = stmt.executeQuery(SQL);
            while (rs.next()) {
               // System.out.println
                        JOptionPane.showMessageDialog(null,rs.getString("marca") + " : " + rs.getString("modelo"));
                        
                        
                        
                           }
           }  catch(SQLException e)
           {
            JOptionPane.showMessageDialog(null,"Error en SQL: "+e.getMessage());
            
           }
           */ 
            
         Ventana a= new Ventana();   
            
            
      }
        
}

